package com.hzit.mmcb.core.controller.api;


import com.hzit.common.result.R;
import com.hzit.mmcb.core.pojo.entity.Lend;
import com.hzit.mmcb.core.service.LendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 标的准备表 前端控制器
 * </p>
 *
 * @author ljh
 * @since 2024-08-27
 */
@RestController
@RequestMapping("/api/core/lend")
@Api(tags = "标的管理")
public class ApiLendController {
    @Autowired
    private LendService lendService;


    /**
     * 查询标的列表
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("查询标的列表")
    private R list(){
        List<Lend> list=lendService.selectList();

        return R.ok().data("list",list);
    }

    /**
     * 利用id查询标的的详细信息
     */
    @GetMapping("/show/{lendId}")
    @ApiOperation("利用id查询标的的详细信息")
    public R show(@PathVariable Long lendId){
        Map<String, Object> lendDetail = lendService.getLendDetail(lendId);
        return R.ok().data("lendDetail",lendDetail);
    }
}

